<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .sullivan-grid {
            border: 1px solid red;
            width: 100px;
            height: 100px;
        }
        .sullivan-grid-item {
            border: 1px solid red;
        }
    </style>
</head>
<body>
<div class="xx"></div>
<div class="xx"></div>
<div class="xx"><h2>33333</h2></div>
<div class="xx"></div>
<script src="./jquery.js"></script>
<script>
    const $h2 = [...$('div:has(h2)')];

    /*while ($h2.length) {
        const item = $h2.pop();
        $(item).find('h2').appendTo($(item).closest('div').next())
        console.log(item)
    }*/

    console.log($('div:has(h2)').index())

</script>
</body>
</html>